<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" type="text/css" href="../../css/api.css" />
    <style>
        .topDiv {
            height: 4.5rem;
            margin: 0;
            background-color: #2780e8;
            width: 100%;
            line-height: 3rem;
            color: #fff;
            font-size: 0.8rem;
        }

        .topDiv img {
            margin: 0.5rem 0.5rem 0 0;
        }

        .main .skill {
            display: flex;
            padding-bottom: 0.5rem;
            flex-direction: row;
            flex-wrap: wrap;
        }

        .skill .skill_item {
            width: 25%;
            height: 4rem;
            text-align: center;
            padding-top: 0.5rem;
        }

        .skill .skill_item img {
            margin: 0.5rem;
            width: 2rem;
            height: 2rem;
            border-radius: 50%;
        }

        .skill .skill_item p {
            font-size: 0.6rem;
        }

        .skill .skill_item:active {
            background-color: #f5f5f5;
        }

        .pharmacy {
            background-color: #fff;
            margin-top: 0.5rem;
            padding: 0.5rem;
        }

        .pharmacy div {
            width: 49%;
            display: inline-block;

        }

        .pharmacy div img {
            width: 100%;
            /* border: 0.05rem solid #eeeeee; */
            padding: 0.5rem 0;
        }

        .pharmacy_first {
            border: 0.05rem solid #eee;
            border-left: none;
        }

        .pharmacy_second {
            float: right;
            padding-left: 0.3rem;
            border-top: 0.05rem solid #eee;
            border-bottom: 0.05rem solid #eee;
        }

        .pharmacy_second img {
            padding: 0.55rem 0 !important;
        }

        .pharmacy_second img:last-child {
            padding: 0.35rem 0 !important;
        }

        .chat {
            width: 100%;
            margin: 0.5rem 0;
        }

        .chat_item {
            height: 2.5rem;
            background-color: #fff;
            position: relative;
        }

        .chat_item img {
            margin: 0.25rem 0 0.25rem 1rem;
            width: 2rem;
            height: 2rem;
        }

        .chat_item .chat_title {
            position: absolute;
            top: 0.25rem;
            left: 3.5rem;
            font-size: 0.7rem;
            color: #565656;
        }

        .chat_item .chat_content {
            position: absolute;
            top: 1.35rem;
            left: 3.5rem;
            font-size: 0.6rem;
            color: #838383;
        }

        .chat_item .chat_time {
            position: absolute;
            top: 0.25rem;
            right: 1rem;
            font-size: 0.6rem;
            color: #828282;
        }

        .zhezhao {
            width: 100%;
            height: 100%;
            position: fixed;
            top: 0;
            left: 0;
            background-color: rgba(0, 0, 0, 0.7);
            z-index: 100;
            text-align: center;
        }

        .zhezhao .zhezhao_main {
            margin: 35% 0 0 2.5rem;
            width: 14rem;
            height: 15.5rem;
            background-color: #fff;
            border-radius: 0.5rem;
            text-align: center;
        }

        .zhezhao .zhezhao_main img {
            width: 5rem;
            height: 5rem;
            margin: 1rem 0 1rem 0;
        }

        .zhezhao .zhezhao_main .title {
            font-size: 0.9rem;
            color: #565656;
            margin-bottom: 1rem;
        }

        .zhezhao .zhezhao_main .subtitle {
            font-size: 0.7rem;
            color: #838383;
            line-height: 1rem;
            margin-bottom: 1rem;
        }

        .zhezhao .zhezhao_main .renzheng_btn {
            background-color: #2780e8;
            width: 11rem;
            height: 2.25rem;
            color: #fff;
            line-height: 2.25rem;
            text-align: center;
            margin-left: 1.5rem;
            border-radius: 0.5rem;
        }

        .item2 {
            background-color: #2780e8;
            padding: 0 .8rem 0.8rem 0.8rem;
        }

        .item2 .title {
            height: 1rem;
            line-height: 1rem;
            color: #fff;
            font-size: 0.8rem;
            margin-bottom: 0.5rem;
        }

        .item2 .title img {
            width: 1rem;
            height: 1rem;
            float: left;
            margin-right: 0.5rem;
            background-color: #fff;
        }

        .item2 .item {
            text-align: center;
            display: inline-block;
            width: 45%;
            background-color: #fff;
            border-radius: 0.5rem;
            color: #2780e8;
        }

        .item2 .item .tips {
            background-color: #d9e6f4;
            height: 1rem;
            line-height: 1rem;
            width: 100%;
            font-size: 0.6rem;
            border-radius: 0 0 0.5rem 0.5rem;
        }

        .item2 .item .name {
            font-size: 0.7rem;
        }

        .item2 .item .nums {
            padding: 0.5rem 0;
            font-size: 0.9rem;
        }

        .item2 .flex {
            display: flex;
            justify-content: space-between;
        }

        .renzheng {
            padding: 0.5rem;
            background-color: #fff;
            border-radius: 0.5rem;
            margin-top: 0.5rem;
        }

        .renzheng .title {
            font-size: 0.8rem;
            color: #d78439;
        }

        .renzheng .subtitle {
            font-size: 0.7rem;
        }

        .renzheng span {
            float: right;
            padding: 0.2rem 0.3rem;
            background-color: #d78439;
            color: #fff;
            font-size: 0.6rem;
            border-radius: 1rem;
            margin-top: -1rem;
        }

        .item3 {
            margin: 0 0.8rem;
            padding: 0.5rem;
            background-color: #fff;
            border-radius: 0.5rem;
        }

        .item3 .item {
            height: 3rem;
            width: 100%;
            margin-bottom: 1rem;
        }

        .item3 .item .text {
            color: #000;
            font-size: 0.7rem;
            margin-top: 0.5rem;
        }

        .item3 .item:last-child {
            margin-bottom: 0;
        }

        .item3 .item div {
            width: 6rem;
            height: 3rem;
            float: left;
            margin-right: 0.5rem;
            background-color: skyblue;
            text-align: center;
            line-height: 3rem;
            font-size: 0.7rem;
            border-radius: 0.5rem;
            color: #fff;
        }

        .p_hide {
            width: 8rem;
        }

        .show {
            position: fixed;
            top: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.5);
            display: flex;
            justify-content: center;
            /* 水平居中 */
            align-items: center;
            /* 垂直居中 */
        }

        .show .main {
            width: 70%;
            min-height: 3rem;
            background-color: #fff;
            border-radius: 0.5rem;
            padding: 0.5rem 0.5rem 0 0.5rem;
            text-align: center;
        }

        .show .main .title {
            font-size: 0.7rem;
            font-weight: bold;
            margin-bottom: 0.5rem;
        }

        .show .main .subtitle {
            font-size: 0.7rem;
            text-align: left;
        }

        .show .main .subtitle span {
            color: #2780e8;
        }

        .show .main .btnDiv {
            display: flex;
            flex-direction: row;
            border-top: 1px solid #ccc;
            margin-top: 0.5rem;
        }

        .show .main .btnDiv div {
            width: 50%;
            text-align: center;
            font-size: 0.8rem;
            padding: 0.6rem 0;
        }

        .show .main .btnDiv div:last-child {
            color: #2780e8;
            border-left: 1px solid #ccc;
            box-sizing: border-box;
        }
    </style>
</head>

<body>
    <div id="app" v-cloak>
        <div class="topDiv">
            <div class="p1rem" v-if="emp">
                <img :src="avatar" v-if="avatar" style="width: 3rem;height: 3rem;float: left;border-radius: 50%;"
                    alt="">
                <img src="../../image/user_avater.png" v-else
                    style="width: 3rem;height: 3rem;float: left;border-radius: 50%;" alt="">
                <span class="p_hide" style="display:flex;height:1.89rem;">您好{{name}},</span>
                <span class="p_hide" style="display:flex;height:1.89rem;">欢迎来到祥愿堂</span>
            </div>
            <div class="p1rem openwin" data-win="widget://html/login" v-else>
                <img src="../../image/user_avater.png" style="width: 3rem;height: 3rem;float: left;" alt="">
                <span>请先登录</span>
            </div>
        </div>

        <div class="main">
            <div class="item2">
                <p class="title">
                    <img src="../../image/ucenter/zhenshi.png" alt="">
                    我的诊室
                </p>
                <div class="flex">
                    <div class="item" onclick="go_wenzhen('1')">
                        <p class="name">待接诊</p>
                        <p class="nums">{{daijiezhen}}</p>
                        <p class="tips">立即处理 ></p>
                    </div>
                    <div class="item" onclick="go_wenzhen('2')">
                        <p class="name">待回复</p>
                        <p class="nums">{{jiezhenzhong}}</p>
                        <p class="tips">立即处理 ></p>
                    </div>
                </div>

                <div class="renzheng" v-if="status == 0 && emp">
                    <p class="title">您可以进行资质认证</p>
                    <span @click="go_add_userInfo_win">资质认证</span>
                    <p class="subtitle">资质认证通过后可以使用更多功能</p>
                </div>
            </div>
            <div class="skill">

                <div class="skill_item" onclick="go_page(1)">
                    <img src="../../image/ucenter/wenzhendan.png" alt="">
                    <p>用药管理</p>
                </div>
                <!-- <div class="skill_item">
                    <img src="../../image/ucenter/invite.png" alt="">
                    <p>邀请医生</p>
                </div>
                <div class="skill_item">
                    <img src="../../image/ucenter/always_case.png" alt="">
                    <p>常用方</p>
                </div> -->
                <div class="skill_item" onclick="go_page(2)">
                    <img src="../../image/ucenter/yiliao_fuwu.png" alt="">
                    <p>医疗服务</p>
                </div>
            </div>

            <div class="item3">
                <!-- <div class="item">
                    <div style="background-color: #ee0909;">收入查询及银行卡绑定操作</div>
                    <p class="text">收入查询及银行卡绑定操作</p>
                </div> -->
                <div class="item openwin" data-win="../caozuo_zhinan_1_win">
                    <div style="background-color: #2972c8;">新手入驻指南</div>
                    <p class="text">祥愿堂新手入驻指南</p>
                </div>
                <div class="item openwin" data-win="../caozuo_zhinan_2_win">
                    <div style="background-color: #8829c8;">操作细节</div>
                    <p class="text">一、不可不知的操作细节，助您快速熟悉产品操作</p>
                </div>
            </div>
        </div>

        <div class="show" v-if="showText">
            <div class="main">
                <div class="title">服务协议和隐私策略</div>
                <p class="subtitle">
                    请您务必谨慎阅读，充分理解“服务协议”和“隐私策略”各条款，包括但不限于：为了向您提供即时通讯、内容分享等服务，我们需要收集您的设备信息、操作日志等个人信息。您可以在“设置”中查看、变更、删除个人信息并管理您的授权。
                    <br>
                    您可以阅读<span onclick="go_xieyi()">《服务条款》</span>和 <span
                        onclick="go_yinsi()">《隐私策略》</span>理解详情信息。如您同意，请点击同意开始接受我们的服务。
                </p>

                <div class="btnDiv">
                    <div @click="no">暂不使用</div>
                    <div @click="agree">同意</div>
                </div>
            </div>
        </div>
    </div>

</body>

</html>
<script src="../../script/set_root.js"></script>

<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/zepto.min.js"></script>
<script type="text/javascript" src="../../script/hb.js"></script>
<script type="text/javascript" src="../../script/vue.js"></script>
<script type="text/javascript">
    apiready = function () {
        hb_ready();
        // alert(JSON.stringify($api.getStorage("emp")))
        // 成功登陆时刷新用户数据

        api.addEventListener({
            name: "update_frm0",
        }, function (res, err) {
            get_ajax("doctor/consult/count/status", {
                doctorId: $api.getStorage("emp").userId,
                status: 2
            }, function (res, err) {
                if (res.code == 2000 && res.data) {
                    app.jiezhenzhong = res.data
                } else {
                    toast("更新完成")
                }
            })
            get_ajax("doctor/consult/count/status", {
                doctorId: $api.getStorage("emp").userId,
                status: 1
            }, function (res, err) {
                if (res.code == 2000 && res.data) {
                    app.daijiezhen = res.data
                }
            })
        })
        api.addEventListener({
            name: 'login'
        }, function (ret, err) {
            if ($api.getStorage("emp")) {
                app.emp = true
                app.avatar = $api.getStorage("emp").avatar ? IMAGE_HTTP + $api.getStorage("emp").avatar : ""
                app.name = $api.getStorage("emp").name ? $api.getStorage("emp").name : "医生" + $api
                    .getStorage("emp").userId
                app.showText = true
                get_ajax("doctor/verify/view", {
                    userId: $api.getStorage("emp").userId
                }, function (res, err) {
                    // alert(JSON.stringify(res))
                    if (res.data == null) {
                        app.status = 0
                        return
                    }
                    if (res.code == 2000 && res.data != null) {
                        if (res.data.status) {
                            app.status = res.data.status
                        } else {
                            app.status = 0
                        }
                    }
                })
            }
            get_ajax("doctor/consult/count/status", {
                doctorId: $api.getStorage("emp").userId,
                status: 2
            }, function (res, err) {
                if (res.code == 2000 && res.data) {
                    app.jiezhenzhong = res.data
                }
            })
            get_ajax("doctor/consult/count/status", {
                doctorId: $api.getStorage("emp").userId,
                status: 1
            }, function (res, err) {
                if (res.code == 2000 && res.data) {
                    app.daijiezhen = res.data
                }
            })
        });
        if ($api.getStorage("emp")) {
            app.emp = true
            app.avatar = $api.getStorage("emp").avatar ? IMAGE_HTTP + $api.getStorage("emp").avatar : ""
            app.name = $api.getStorage("emp").name ? $api.getStorage("emp").name : "医生" + $api
                .getStorage("emp").userId
            get_ajax("doctor/verify/view", {
                userId: $api.getStorage("emp").userId
            }, function (res, err) {
                // console.log(JSON.stringify(res))
                if (res.data == null) {
                    app.status = 0
                    return
                }
                if (res.code == 2000 && res.data != null) {
                    if (res.data.status) {
                        app.status = res.data.status
                    } else {
                        app.status = 0
                    }
                }
            })
            get_ajax("doctor/consult/count/status", {
                doctorId: $api.getStorage("emp").userId,
                status: 2
            }, function (res, err) {
                if (res.code == 2000 && res.data) {
                    app.jiezhenzhong = res.data
                }
            })
            get_ajax("doctor/consult/count/status", {
                doctorId: $api.getStorage("emp").userId,
                status: 1
            }, function (res, err) {
                if (res.code == 2000 && res.data) {
                    app.daijiezhen = res.data
                }
            })

            //下拉刷新
            api.setRefreshHeaderInfo({
                loadingImg: 'widget://image/refresh.png',
                bgColor: '#ccc',
                textColor: '#fff',
                textDown: '下拉刷新...',
                textUp: '松开刷新...'
            }, function (ret, err) {
                //在这里从服务器加载数据，加载完成后调用api.refreshHeaderLoadDone()方法恢复组件到默认状态
                get_ajax("doctor/consult/count/status", {
                    doctorId: $api.getStorage("emp").userId,
                    status: 2
                }, function (res, err) {
                    if (res.code == 2000 && res.data) {
                        app.jiezhenzhong = res.data
                    } else {
                        toast("更新完成")
                    }
                })
                get_ajax("doctor/consult/count/status", {
                    doctorId: $api.getStorage("emp").userId,
                    status: 1
                }, function (res, err) {
                    if (res.code == 2000 && res.data) {
                        app.daijiezhen = res.data
                    }
                })
                setTimeout(function () {
                    api.refreshHeaderLoadDone()
                }, 1500);
            });
        }


        if (!$api.getStorage("first_login") || $api.getStorage("first_login") == "false") {
            app.showText = true
        } else {
            app.showText = false
        }
    }

    var app = new Vue({
        el: "#app",
        data: {
            emp: false,
            avatar: "",
            // identifier: "",
            name: "", // 存在缓存里面的医生姓名
            renzheng_show: true,
            status: 0, // 是否通过审核，0>未  1>过
            showText: false,
            jiezhenzhong: 0, // 接诊中
            daijiezhen: 0, // 待接诊
        },
        created: function () {
            if ($api.getStorage("token") && $api.getStorage("emp")) {
                this.emp = true;
            }
        },
        methods: {
            go_add_userInfo_win() {
                // add_userInfo_win  // 这是原来的认证
                api.openWin({
                    name: "doctor_info_win",
                    url: "widget://html/doctor/doctor_info_win.html",
                })
            },
            no() {
                api.closeWidget({
                    id: "A6041553163416",
                    retData: {
                        name: 'closeWidget'
                    },
                    animation: {
                        type: 'flip',
                        subType: 'from_bottom',
                        duration: 500
                    },
                    silent: true
                });
            },
            agree() {
                sendting("closeShow")
                app.showText = false
                $api.setStorage("first_login", true)
                //获取权限
                isJuris('storage', '存储'); //存储权限
                // isJuris('camera', '相机'); //相机权限
                // isJuris('microphone', '麦克风'); //麦克风权限
            },
        },
    })

    function go_add_userInfo_win() {
        if (!$api.getStorage("emp")) {
            api.openWin({
                name: "login",
                url: "../widget://html/login.html",
            })
        } else {
            api.openWin({
                name: "add_userInfo_win",
                url: "../add_userInfo_win.html",
            })
        }
    }

    function go_xieyi() {
        api.openWin({
            name: "fuwu_tiaokuan_win",
            url: "widget://html/fuwu_tiaokuan_win.html",
        })
    }

    function go_yinsi() {
        api.openWin({
            name: "yinsi_win",
            url: "widget://html/yinsi_win.html",
        })
    }

    function go_wenzhen(status) {
        if (app.status == 0) {
            toast("您需要先通过认证")
            return
        }
        api.openWin({
            name: "wenzhen_win",
            url: "widget://html/wenzhen_win.html",
            pageParam: {
                status: status
            }
        })
    }

    function go_page(index) {
        if (app.status == 0) {
            toast("您需要先通过认证")
            return
        }
        if (index == 1) {
            api.openWin({
                name: "wenzhen_win",
                url: "widget://html/wenzhen_win.html",
            })
        } else if (index == 2) {
            api.openWin({
                name: "my_medical_service_win",
                url: "../my_medical_service_win.html"
            })
        }
    }
</script>
